<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="/template/MemberItineraryTemplate.xhtml">

    <ui:define name="contentInsert">

        <p:panel id="wholePanel" header="#{groupBuyCustManagedBean.selectedItem.name}"
                 style="text-align: center; font-size: larger; width: 120%; margin-left: 5%; margin-right:5%">
            <h:form>

                <h:panelGrid columns="3" style="text-align: left; border-right: #BBBBBB;
                             border-right-style: ridge; " styleClass="padding-bottom">

                    <h:outputLabel for="originalPrice" value="Original Price: "/>
                    <h:outputText id="originalPrice" value="#{groupBuyCustManagedBean.selectedItem.originalPrice}"/>
                    <p:message for="originalPrice"/>


                    <h:outputLabel for="offerPrice" value="Offering Price: "/>
                    <h:outputText id="offerPrice" value="#{groupBuyCustManagedBean.selectedItem.offeredPrice}" />
                    <p:message for="offerPrice"/>

                    <h:outputLabel for="effectiveStart" value="Effective Start Date: "/>
                    <h:outputText id="effectiveStart" value="#{groupBuyCustManagedBean.selectedItem.effectiveStartStr}" />
                    <p:message for="effectiveStart"/>


                    <h:outputLabel for="effectiveEnd" value="Effective End Date: "/>
                    <h:outputText id="effectiveEnd" value="#{groupBuyCustManagedBean.selectedItem.effectiveEndStr}" />
                    <p:message for="effectiveEnd"/>

                    <h:outputLabel for="redemptionStart" value="Redemption Start Date: "/>
                    <h:outputText id="redemptionStart" value="#{groupBuyCustManagedBean.selectedItem.redemptionStartStr}"/>
                    <p:message for="redemptionStart"/>

                    <h:outputLabel for="redemptionEnd" value="Redemption End Date: "/>
                    <h:outputText id="redemptionEnd" value="#{groupBuyCustManagedBean.selectedItem.redemptionEndStr}" />
                    <p:message for="redemptionEnd"/>

                    <h:outputLabel for="minQuota" value="Minimum Quota: "/>
                    <h:outputText id="minQuota" value="#{groupBuyCustManagedBean.selectedItem.minQuota}" />
                    <p:message for="minQuota"/>

                    <h:outputLabel for="maxQuota" value="Maximum Quota: "/>
                    <h:outputText id="maxQuota" value="#{groupBuyCustManagedBean.selectedItem.maxQuota}" />
                    <p:message for="maxQuota"/>

                    <h:outputLabel for="requireBooking" value="Require booking: "/>
                    <h:outputText id="requireBooking" value="#{groupBuyCustManagedBean.selectedItem.requireBooking? 'Yes':'No'}"/>
                    <p:message for="requireBooking"/>


                    <h:outputLabel for="validateRequirements" value="Validate Requirements: "/>
                    <h:outputText id="validateRequirements" 
                                  value="#{groupBuyCustManagedBean.selectedItem.validateRequirements}" />
                    <p:message for="validateRequirements"/>


                    <h:outputLabel for="description" value="Description: "/> 
                    <h:outputText id="description" 
                                  value="#{groupBuyCustManagedBean.selectedItem.description}"
                                  style="width:500px; height:300px" escape="false"/>
                    <p:message for="description"/>

                    <h:outputText value="Select number to buy: "/>
                    <h:selectOneMenu value="#{groupBuyCustManagedBean.numberToBuy}"
                                     style="width:100%">
                        <f:selectItem itemValue=""
                                      itemLabel="Select Number"/>
                        <f:selectItems value="#{groupBuyCustManagedBean.computeQuotaSeq()}"/>
                        <p:ajax update="wholePanel"
                                listener="#{groupBuyCustManagedBean.handleNumberToBuyChange()}" /> 
                    </h:selectOneMenu>  
                    <p:ajaxStatus style="width:16px;height:16px;">  
                        <f:facet name="start">  
                            <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />  
                        </f:facet>  

                        <f:facet name="complete">  
                            <h:outputText value="" />  
                        </f:facet>  
                    </p:ajaxStatus> 

                    <h:outputText value="Total Price (SGD): "/>
                    <h:outputText id="total" value="#{groupBuyCustManagedBean.subtotal}"/>

                </h:panelGrid>
            </h:form>
            <h:panelGrid columns="2" style="width:100%">
                <form id="id_PaypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" 
                      style="margin-left:auto;margin-right:auto;">  

                    <input type="hidden" name="cmd" value="_xclick"/>  
                    <input type="hidden" name="business" value="#{returnURLMB.tCubePayPalEmail}"/>  
                    <input type="hidden" name="item_name"   value="Group Deal Subscription"/>  
                    <input type="hidden" name="item_number" value="0"/>  
                    <input type="hidden" name="amount" value="#{groupBuyCustManagedBean.subtotal}"/>  
                    <input type="hidden" name="tax" value="0"/>  
                    <input type="hidden" name="quantity" value="1"/>  
                    <input type="hidden" name="no_note" value="1"/>  
                    <input type="hidden" name="currency_code" value="SGD"/> 
                    <input type="hidden" name="return" value="#{returnURLMB.getReturnURL_buyGroupDeal()}"/> 

                    <input type="image" name="submit" border="0"
                           src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"  
                           alt="PayPal - The safer, easier way to pay online"/>  

                </form>  
                <h:form>
                    <p:commandButton value="Back" action="custsearchengine?faces-redirect=true"/>
                </h:form>
            </h:panelGrid>
        </p:panel>



    </ui:define>
</ui:composition>
